package com.smart.village.big.screen.controller.micro;

import com.alibaba.fastjson.JSONObject;
import com.smart.village.big.screen.domain.AjaxResult;
import com.smart.village.big.screen.service.MicroSmartMoHeResidentService;
import com.smart.village.big.screen.service.MicroSmartMoHeTouristService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.logging.Logger;

import static com.smart.village.big.screen.domain.AjaxResult.error;
import static com.smart.village.big.screen.domain.AjaxResult.success;

/**
 * 小程序-数智漠河-村民端
 */
@Tag(name = "小程序-数智漠河-村民端")
@RestController
@RequestMapping("/micro/smart/mohe/resident")
public class MicroSmartMoHeResidentController {
    Logger logger = Logger.getLogger(MicroSmartMoHeResidentController.class.getName());
    @Autowired
    private MicroSmartMoHeResidentService microSmartMoHeResidentService;
    @Autowired
    private MicroSmartMoHeTouristService microSmartMoHeTouristService;


    @Operation(summary = "三务公开-标题和数量")
    @Parameters({
            @Parameter(name = "type", description = "类型必传 三资公开、三务公开"),
            @Parameter(name = "townNumber", description = "镇编码 非必传"),
            @Parameter(name = "villageNumber", description = "村编码 非必传"),
            @Parameter(name = "beginDate", description = "开始时间 非必传"),
            @Parameter(name = "endDate", description = "结束时间 非必传"),
    })
    @GetMapping("/getThreeAffairsDisclosureTitleList")
    @ResponseBody
    public AjaxResult getThreeAffairsDisclosureTitleList(
            @RequestParam String type,
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String beginDate,
            @RequestParam(required = false) String endDate

    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getThreeAffairsDisclosureTitleList(type, townNumber, villageNumber, beginDate, endDate));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "三务公开")
    @Parameters({
            @Parameter(name = "townNumber", description = "镇编码 非必传"),
            @Parameter(name = "villageNumber", description = "村编码 非必传"),
            @Parameter(name = "type", description = "类型 必传"),
            @Parameter(name = "partOrganizationSerialNumber", description = "党组id 非必传"),
            @Parameter(name = "beginDate", description = "开始时间 非必传"),
            @Parameter(name = "endDate", description = "结束时间 非必传"),
    })
    @GetMapping("/getThreeAffairsDisclosureList")
    @ResponseBody
    public AjaxResult getThreeAffairsDisclosureList(
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String partOrganizationSerialNumber,
            @RequestParam String type,
            @RequestParam(required = false) String beginDate,
            @RequestParam(required = false) String endDate,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {

            return AjaxResult.success(microSmartMoHeResidentService.getThreeAffairsDisclosureList(townNumber, villageNumber, partOrganizationSerialNumber, type, beginDate, endDate, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "三务公开-详情")
    @Parameters({
            @Parameter(name = "affairsSerialNumber", description = "三务公开ID 必传"),
    })
    @GetMapping("/getThreeAffairsDisclosureDetail")
    @ResponseBody
    public AjaxResult getThreeAffairsDisclosureDetail(
            @RequestParam String affairsSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getThreeAffairsDisclosureDetail(affairsSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "政策补贴")
    @Parameters({
            @Parameter(name = "policyTypeSerialNumber", description = "政策类型 必传"),
            @Parameter(name = "year", description = "年份 必传"),
    })
    @GetMapping("/getSubsidyPolicyList")
    @ResponseBody
    public AjaxResult getSubsidyPolicyList(
            @RequestParam String policyTypeSerialNumber,
            @RequestParam String year,
            @RequestParam(required = false) String search,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getSubsidyPolicyList(year, policyTypeSerialNumber, search, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "政策补贴-详情")
    @Parameters({
            @Parameter(name = "policySerialNumber", description = "政策补贴ID 必传"),
            @Parameter(name = "policyTypeSerialNumber", description = "政策补贴类型 必传"),
    })
    @GetMapping("/getSubsidyPolicyDetail")
    @ResponseBody
    public AjaxResult getSubsidyPolicyDetail(
            @RequestParam String policySerialNumber,
            @RequestParam String policyTypeSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getSubsidyPolicyDetail(policySerialNumber, policyTypeSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "我的家乡-村情简介")
    @Parameters({
            @Parameter(name = "districtNumber", description = "村ID 必传"),
    })
    @GetMapping("/getDistrictIntroduction")
    @ResponseBody
    public AjaxResult getDistrictIntroduction(
            @RequestParam String districtNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getDistrictIntroduction(districtNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "民意速达-全部-我的服务人员")
    @Parameters({
            @Parameter(name = "iDCardNumber", description = "身份证号 必传"),
            @Parameter(name = "role", description = "角色 非必传"),
    })
    @GetMapping("/getMyServiceMemberList")
    @ResponseBody
    public AjaxResult getMyServiceMemberList(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false) String role
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMyServiceMemberList(iDCardNumber, role));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "边补打卡")
    @Parameters({
            @Parameter(name = "phone", description = "身份证号 必传"),
            @Parameter(name = "beginDate", description = "开始时间 必传"),
            @Parameter(name = "endDate", description = "结束时间 必传"),
    })
    @GetMapping("/getPatrolCheckInList")
    @ResponseBody
    public AjaxResult getPatrolCheckInList(
            @RequestParam String phone,
            @RequestParam(required = false) String beginDate,
            @RequestParam(required = false) String endDate
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getPatrolCheckInList(phone, beginDate, endDate));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "驻村工作队")
    @Parameters({
            @Parameter(name = "villageNumber", description = "村编码 必传")
    })
    @GetMapping("/getWorkTeamsByVillageNumber")
    @ResponseBody
    public AjaxResult getWorkTeamsByVillageNumber(
            @RequestParam String villageNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getWorkTeamsByVillageNumber(villageNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "项目在线新闻")
    @Parameters({
            @Parameter(name = "NewsTerminal", description = "新闻终端 必传"),
            @Parameter(name = "townNumber", description = "镇编码 必传"),
            @Parameter(name = "villageNumber", description = "村编码 必传"),
            @Parameter(name = "beginDate", description = "开始时间 非必传"),
            @Parameter(name = "endDate", description = "结束时间 非必传"),
            @Parameter(name = "search", description = "状态 非必传"),
    })
    @GetMapping("/getProjectOnlineNewsList")
    @ResponseBody
    public AjaxResult getProjectOnlineNewsList(
            @RequestParam String NewsTerminal,
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String beginDate,
            @RequestParam(required = false) String endDate,
            @RequestParam(required = false) String search,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getProjectOnlineNewsList(NewsTerminal,townNumber, villageNumber, beginDate, endDate, search, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "乡村议事厅")
    @Parameters({
            @Parameter(name = "status", description = "活动状态"),
            @Parameter(name = "iDCardNumber", description = "身份证号"),
            @Parameter(name = "villageNumber", description = "村编码"),
            @Parameter(name = "assembly", description = "集会类型 是否为议事厅 0:村级活动   1:社区议事厅"),
    })
    @GetMapping("/getVillageActivities")
    @ResponseBody
    public AjaxResult getVillageActivities(
            @RequestParam String status,
            @RequestParam(required = false) String iDCardNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam String assembly,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getVillageActivities(status, iDCardNumber, villageNumber, assembly, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "乡村议事厅-详情")
    @Parameters({
            @Parameter(name = "villageActivitiesSerialNumber", description = "活动ID 必传"),
    })
    @GetMapping("/getVillageActivitiesDetail")
    @ResponseBody
    public AjaxResult getVillageActivitiesDetail(
            @RequestParam String villageActivitiesSerialNumber,
            @RequestParam String iDCardNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getVillageActivitiesDetail(villageActivitiesSerialNumber,iDCardNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "惠民服务-八个图标")
    @Parameters({

    })
    @GetMapping("/getBeneficialPeopleLogoList")
    @ResponseBody
    public AjaxResult getBeneficialPeopleLogoList(
            @RequestParam(required = false,defaultValue = "") String parentSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getBeneficialPeopleLogoList(parentSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "惠民服务-更多")
    @Parameters({

    })
    @GetMapping("/getBeneficialPeopleLogoListMore")
    @ResponseBody
    public AjaxResult getBeneficialPeopleLogoListMore(
            @RequestParam(required = false,defaultValue = "") String parentSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getBeneficialPeopleLogoListMore(parentSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }



    @Operation(summary = "村级清单-类型列表-根据父级类型寻找子级类型")
    @Parameters({
            @Parameter(name = "parentSerialNumber", description = "父级类型ID")
    })
    @GetMapping("/getListTypeByParentSerialNumber")
    @ResponseBody
    public AjaxResult getListTypeByParentSerialNumber(
            @RequestParam(required = false,defaultValue = "") String parentSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getListTypeByParentSerialNumber(parentSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "村级清单-列表")
    @Parameters({
            @Parameter(name = "listTypeSerialNumber", description = "清单类型ID"),
            @Parameter(name = "townNumber", description = "镇id"),
            @Parameter(name = "villageNumber", description = "村id"),
            @Parameter(name = "level", description = "级别 0 市级，1镇级，3村级"),


    })
    @GetMapping("/getListManagement")
    @ResponseBody
    public AjaxResult getListManagement(
            @RequestParam(required = false) String listTypeSerialNumber,
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String level,
            @RequestParam(required = false) String search,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getListManagement(listTypeSerialNumber,townNumber,villageNumber,level, search, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "村级清单-详情")
    @Parameters({
            @Parameter(name = "listManagementSerialNumber", description = "清单ID"),

    })
    @GetMapping("/getListManagementDetail")
    @ResponseBody
    public AjaxResult getListManagementDetail(
            @RequestParam String listManagementSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getListManagementDetail(listManagementSerialNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    @Operation(summary = "我的积分-我的积分")
    @Parameters({
            @Parameter(name = "iDCardNumber", description = "身份证号"),
    })
    @GetMapping("/getMyPoints")
    @ResponseBody
    public AjaxResult getMyPoints(
            @RequestParam String iDCardNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMyPoints(iDCardNumber));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    @Operation(summary = "我的积分-村民积分-我的订单")
    @Parameters({
            @Parameter(name = "iDCardNumber", description = "身份证号"),
    })
    @GetMapping("/getMyVillageSaleOrderList")
    @ResponseBody
    public AjaxResult getMyVillageSaleOrderList(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMyVillageSaleOrderList(iDCardNumber, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "我的积分-村民积分-积分收入")
    @Parameters({
            @Parameter(name = "iDCardNumber", description = "身份证号"),
    })
    @GetMapping("/getMyVillageSaleOrderIncome")
    @ResponseBody
    public AjaxResult getMyVillageSaleOrderIncome(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMyVillageSaleOrderIncome(iDCardNumber, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "我的积分-村民积分-积分支出")
    @Parameters({
            @Parameter(name = "iDCardNumber", description = "身份证号"),
    })
    @GetMapping("/getMyVillageSaleOrderExpenditure")
    @ResponseBody
    public AjaxResult getMyVillageSaleOrderExpenditure(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMyVillageSaleOrderExpenditure(iDCardNumber, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }



    /**
     * 我的诉求
     *
     * @return
     */
    @Operation(summary = "我的诉求")
    @GetMapping("getMyComplaints")
    @ResponseBody
    public AjaxResult getMyComplaints(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "待指派、处理中、已处理、拒绝")  String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyComplaints(phone, status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的诉求详情
     *
     * @return
     */
    @Operation(summary = "我的诉求详情")
    @Parameters({
            @Parameter(name = "complaintId", description = "我的诉求详情id"),
    })
    @GetMapping("getMyComplaintsDetail")
    @ResponseBody
    public AjaxResult getMyComplaintsDetail(
            @RequestParam String complaintId
    ) {
        try {

            return success(microSmartMoHeResidentService
                    .getMyComplaintsDetail(complaintId)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的诉求详情-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    @Operation(summary = "三资公开-列表")
    @Parameters({
            @Parameter(name = "townNumber", description = "镇编码 非必传"),
            @Parameter(name = "villageNumber", description = "村编码 非必传"),
            @Parameter(name = "category", description = "分类 非必传"),
            @Parameter(name = "beginDate", description = "开始时间 非必传"),
            @Parameter(name = "endDate", description = "结束时间 非必传"),
    })
    @GetMapping("/getThreeResourceDisclosureList")
    @ResponseBody
    public AjaxResult getThreeResourceDisclosureList(
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String category,
            @RequestParam(required = false) String beginDate,
            @RequestParam(required = false) String endDate,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getThreeResourceDisclosureList(townNumber, villageNumber, category,beginDate,endDate, pageNum, pageSize));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  通知公告
     *
     * @param villageNumber
     * @return
     */
    @Operation(summary = "通知公告 最新的10条数据")
    @GetMapping("/getNoticePublish")
    @ResponseBody

    public AjaxResult getNoticePublish(
            @RequestParam @Parameter(description = "新闻终端") String NewsTerminal,
            @RequestParam(required = false) @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getNoticePublish(townNumber,villageNumber, pageNum, pageSize,1,NewsTerminal));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "干部选拔任用公示")
    @GetMapping("/getCadreSelectionAppointment")
    @ResponseBody

    public AjaxResult getCadreSelectionAppointment(
            @RequestParam @Parameter(description = "新闻终端") String NewsTerminal,
            @RequestParam(required = false) @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "年月 2025-08") String yearMonth,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getCadreSelectionAppointment(townNumber,villageNumber,yearMonth, pageNum, pageSize,1,NewsTerminal));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 根据新闻主键 获取详情
     *
     * @param newsSerialNumber
     * @return
     */
    @Operation(summary = "小程序 新闻列表 根据新闻序列号 获取详情")
    @GetMapping("/getNewsDetail")
    @ResponseBody
    public AjaxResult getNewsDetail( @RequestParam @Parameter(description = "新闻序列号") String newsSerialNumber) {
        try {
            return success(microSmartMoHeResidentService.getNewsDetail(newsSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 专题专栏-普法宣传-标签列表
     *
     * @return
     */
    @Operation(summary = "专题专栏-普法宣传-标签列表")
    @GetMapping("/getLawPopularizationTagList")
    @ResponseBody
    public AjaxResult getLawPopularizationTagList() {
        try {
            return success(microSmartMoHeResidentService.getLawPopularizationTagList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  专题专栏-普法宣传
     *
     * @param newsTagSerialNumber
     * @return
     */
    @Operation(summary = "专题专栏-普法宣传")
    @GetMapping("/getLawPopularization")
    @ResponseBody

    public AjaxResult getLawPopularization(
            @RequestParam @Parameter(description = "新闻终端") String NewsTerminal,
            @RequestParam(required = false) @Parameter(description = "标签序列号") String newsTagSerialNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getLawPopularization(newsTagSerialNumber, pageNum, pageSize,1,NewsTerminal));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    /**
     * 专题专栏-反诈宣传-标签列表
     *
     * @return
     */
    @Operation(summary = "专题专栏-反诈宣传-标签列表")
    @GetMapping("/getAntiPhishingTagList")
    @ResponseBody
    public AjaxResult getAntiPhishingTagList() {
        try {
            return success(microSmartMoHeResidentService.getAntiPhishingTagList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  专题专栏-反诈宣传
     *
     * @param newsTagSerialNumber
     * @return
     */
    @Operation(summary = "专题专栏-反诈宣传")
    @GetMapping("/getAntiPhishing")
    @ResponseBody

    public AjaxResult getAntiPhishing(
            @RequestParam @Parameter(description = "新闻终端") String NewsTerminal,
            @RequestParam(required = false) @Parameter(description = "标签序列号") String newsTagSerialNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getAntiPhishing(newsTagSerialNumber, pageNum, pageSize,1,NewsTerminal));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  积分商城
     *
     * @param villageNumber
     * @return
     */
    @Operation(summary = "积分商城")
    @GetMapping("/getIntegralMall")
    @ResponseBody

    public AjaxResult getIntegralMall(
            @RequestParam(required = false) @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "分类名称") String categoryName,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getIntegralMall(townNumber,villageNumber,categoryName, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    // 获取积分商城分类
    @Operation(summary = "获取积分商城分类")
    @GetMapping("/getIntegralMallCategory")
    @ResponseBody
    public AjaxResult getIntegralMallCategory() {
        try {
            return success(microSmartMoHeResidentService.getIntegralMallCategory());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    //获取积分商城商品详情
    @Operation(summary = "获取积分商城商品详情")
    @GetMapping("/getIntegralMallDetail")
    @ResponseBody
    public AjaxResult getIntegralMallDetail(@RequestParam @Parameter(description = "商品序列号") String specificationsSerialNumber) {
        try {
            return success(microSmartMoHeResidentService.getIntegralMallDetail(specificationsSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 小程序 党员档案
     * @param phone
     * @return
     */
    @Operation(summary = "小程序 党员档案")
    @Parameters({
            @Parameter(name = "phone", description = "手机号"),
    })
    @GetMapping("/getMicroPartyMemberInformationByPhone")
    @ResponseBody
    public AjaxResult getMicroPartyMemberInformationByPhone(
            @RequestParam String phone
    ){
        try {
            return success(microSmartMoHeResidentService.getMicroPartyMemberInformationByPhone(phone));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }



    /**
     *  积分申请列表-按状态和手机号查询
     *
     * @param phone
     * @param status
     * @return
     */
    @Operation(summary = "积分申请列表")
    @GetMapping("/getIntegralApplicationList")
    @ResponseBody

    public AjaxResult getIntegralApplicationList(
            @RequestParam String phone,
            @RequestParam(required = false) @Parameter(description = "状态") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getIntegralApplicationList(phone,status, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  积分申请详情
     *
     * @param personalPointsApplicationSerialNumber
     * @return
     */
    @Operation(summary = "积分申请详情")
    @GetMapping("/getIntegralApplicationDetail")
    @ResponseBody

    public AjaxResult getIntegralApplicationDetail(
            @RequestParam String personalPointsApplicationSerialNumber

    ) {
        try {
            return success(microSmartMoHeResidentService.getIntegralApplicationDetail(personalPointsApplicationSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  政策补贴-我的种植补贴
     * @param iDCardNumber
     * @param townNumber
     * @param villageNumber
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Operation(summary = " 政策补贴-我的种植补贴")
    @GetMapping("/getMySubsidyPolicyList")
    @ResponseBody

    public AjaxResult getMySubsidyPolicyList(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false) String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search,
            @RequestParam(required = false) @Parameter(description = "状态") String status,
            @RequestParam(required = false) @Parameter(description = "年") String year,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getMySubsidyPolicyList(iDCardNumber,townNumber, villageNumber,search,status,year,pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  政策补贴-我的种植补贴-详情
     * @param applicationSerialNumber
     * @return
     */
    @Operation(summary = " 政策补贴-我的种植补贴-详情")
    @GetMapping("/getMySubsidyPolicyDetail")
    @ResponseBody

    public AjaxResult getMySubsidyPolicyDetail(
            @RequestParam String applicationSerialNumber
    ) {
        try {
            return success(microSmartMoHeResidentService.getMySubsidyPolicyDetail(applicationSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    /**
     *  政策补贴-我的农机补贴
     * @param iDCardNumber
     * @param search
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Operation(summary = " 政策补贴-我的农机补贴")
    @GetMapping("/getMySubsidyPolicyAgriculturalMachineryList")
    @ResponseBody

    public AjaxResult getMySubsidyPolicyAgriculturalMachineryList(
            @RequestParam String iDCardNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search,
            @RequestParam(required = false) @Parameter(description = "状态") String status,
            @RequestParam(required = false) @Parameter(description = "年") String year,

            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getMySubsidyPolicyAgriculturalMachineryList(iDCardNumber,search,status,year,pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  政策补贴-我的农机补贴-详情
     * @param applicationSerialNumber
     * @return
     */
    @Operation(summary = " 政策补贴-我的农机补贴-详情")
    @GetMapping("/getMySubsidyPolicyAgriculturalMachineryDetail")
    @ResponseBody

    public AjaxResult getMySubsidyPolicyAgriculturalMachineryDetail(
            @RequestParam String applicationSerialNumber
    ) {
        try {
            return success(microSmartMoHeResidentService.getMySubsidyPolicyAgriculturalMachineryDetail(applicationSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 我的举报-数智漠河小程序
     *
     * @return
     */
    @Operation(summary = "我的举报-数智漠河小程序")
    @GetMapping("getMyComplaintMoheList")
    @ResponseBody
    public AjaxResult getMyComplaintMoheList(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "提交、处理中、已处理、拒绝")  String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyComplaintMoheList(phone, status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }
    /**
     * 我的举报-详情-数智漠河小程序
     *
     * @return
     */
    @Operation(summary = "我的举报-详情-数智漠河小程序")
    @GetMapping("getMyComplaintMoheDetail")
    @ResponseBody
    public AjaxResult getMyComplaintMoheDetail(
            @RequestParam @Parameter(description = "举报id") String complaintId
           ) {
        {
            try {

                return success(
                        microSmartMoHeResidentService.
                                getMyComplaintMoheDetail(complaintId));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }
    /**
     * 我的评价-数智漠河小程序
     *
     * @return
     */
    @Operation(summary = "我的评价-数智漠河小程序")
    @GetMapping("getMyRatingMoheList")
    @ResponseBody
    public AjaxResult getMyRatingMoheList(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "已评价、未评价")  String status,
            @RequestParam @Parameter(description = "评价来源 小程序-线上举报、小程序-民生诉求、帮办代办、随手拍")  String source,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyRatingMoheList(phone, status,source,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }
    // 我的评价-详情
    @Operation(summary = "我的评价-详情")
    @GetMapping("getMyRatingMoheDetail")
    @ResponseBody
    public AjaxResult getMyRatingMoheDetail(
            @RequestParam @Parameter(description = "评价来源 小程序-线上举报、小程序-民生诉求、帮办代办")  String source,
            @RequestParam @Parameter(description = "评价id") String complaintId) {
        {
            try {
                return success(
                        microSmartMoHeResidentService.
                                getMyRatingMoheDetail(complaintId,source));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的全部店铺-住宿类
     *
     * @return
     */
    @Operation(summary = "我的全部店铺-住宿类")
    @GetMapping("getMyAllShopList")
    @ResponseBody
    public AjaxResult getMyAllShopList(
            @RequestParam @Parameter(description = "身份证号") String iDCardNumber,
            @RequestParam(required = false) @Parameter(description = "店铺类型") String category,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyAllShopList(iDCardNumber,category,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }


    /**
     * 我的全部店铺-住宿类-不分页
     *
     * @return
     */
    @Operation(summary = "我的全部店铺-住宿类-不分页")
    @GetMapping("getMyAllShopListNoPage")
    @ResponseBody
    public AjaxResult getMyAllShopListNoPage(
            @RequestParam @Parameter(description = "身份证号") String iDCardNumber,
            @RequestParam(required = false) @Parameter(description = "店铺类型") String category
        ) {
        {
            try {

                return success(
                        microSmartMoHeResidentService.
                                getMyAllShopListNoPage(iDCardNumber,category));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的全部店铺-住宿类-详情
     *
     * @return
     */
    @Operation(summary = "我的全部店铺-住宿类-详情")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
    })
    @GetMapping("getMyShopDetail")
    @ResponseBody
    public AjaxResult getMyShopDetail(
            @RequestParam String shopSerialNumber
            ,@RequestParam(required = false) String currentCoords
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelApartmentShopDetail(shopSerialNumber,currentCoords));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的全部店铺-住宿类-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 我的全部店铺-住宿类-房间类型-详情
     *
     * @return
     */
    @Operation(summary = "我的全部店铺-住宿类-房间类型-详情")
    @Parameters({
            @Parameter(name = "roomTypeSerialNumber", description = "房间类型编号必填"),
    })
    @GetMapping("getMyShopTypeDetail")
    @ResponseBody
    public AjaxResult getMyShopTypeDetail(
            @RequestParam String roomTypeSerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelApartmentRoomTypeDetail(roomTypeSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的全部店铺-住宿类-房间类型列表: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 我的店铺-预定信息
     *
     * @return
     */
    @Operation(summary = "我的店铺-预定信息")
    @GetMapping("getMyShopBookList")
    @ResponseBody
    public AjaxResult getMyShopBookList(
            @RequestParam @Parameter(description = "身份证号") String iDCardNumber,
            @RequestParam(required = false) @Parameter(description = "预定状态") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyShopBookList(iDCardNumber,status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的办理-惠民服务
     *
     * @return
     */
    @Operation(summary = "我的办理-惠民服务")
    @GetMapping("getMyBenefitList")
    @ResponseBody
    public AjaxResult getMyBenefitList(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "状态 0 处理中 2 已完成") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyBenefitList(phone,status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }


    /**
     * 我的办理-帮办代办
     *
     * @return
     */
    @Operation(summary = "我的办理-帮办代办")
    @GetMapping("getMyHelpList")
    @ResponseBody
    public AjaxResult getMyHelpList(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "状态 0 处理中 2 已完成") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyHelpList(phone,status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 帮办代办-详情
     *
     * @return
     */
    @Operation(summary = "帮办代办-详情")
    @GetMapping("getMyHelpListDetail")
    @ResponseBody
    public AjaxResult getMyHelpListDetail(
            @RequestParam @Parameter(description = "申请编号") String applicationSerialNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getMyHelpListDetail(applicationSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 我的申报-帮办代办
     *
     * @return
     */
    @Operation(summary = "我的申报-帮办代办")
    @GetMapping("getMyApplyList")
    @ResponseBody
    public AjaxResult getMyApplyList(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "状态 0 审核 2 通过 3 拒绝") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyApplyList(phone,status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }


    /**
     * 申报-详情
     *
     * @return
     */
    @Operation(summary = "我的申报-详情")
    @GetMapping("getMyApplyDetail")
    @ResponseBody
    public AjaxResult getMyApplyDetail(
            @RequestParam @Parameter(description = "申请编号") String projectSerialNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getMyApplyDetail(projectSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 我的项目进度
     *
     * @return
     */
    @Operation(summary = "我的项目进度")
    @GetMapping("getMyVillageProject")
    @ResponseBody
    public AjaxResult getMyVillageProject(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "状态 2 审核通过 4 进行中 5 已完成") String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeResidentService.
                                getMyVillageProject(phone,status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的项目进度-详情
     *
     * @return
     */
    @Operation(summary = "我的项目进度-详情")
    @GetMapping("getMyVillageProjectDetail")
    @ResponseBody
    public AjaxResult getMyVillageProjectDetail(
            @RequestParam @Parameter(description = "申请编号") String projectSerialNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getMyVillageProjectDetail(projectSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 我的家乡-组织结构-第一部分 六个指标
     *
     * @return
     */
    @Operation(summary = "我的家乡-组织结构-第一部分 六个指标")
    @GetMapping("getOrganizationPartOne")
    @Parameters
    @ResponseBody
    public AjaxResult getOrganizationPartOne(
            @RequestParam(required = false) @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getOrganizationPartOne(townNumber,villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 村级通讯录
     *
     * @return
     */
    @Operation(summary = "村级通讯录")
    @GetMapping("getVillageContactList")
    @Parameters({
            @Parameter(description = "镇id"),
            @Parameter(description = "村id"),
            @Parameter(description = "搜索")
    })
    @ResponseBody
    public AjaxResult getVillageContactList(
            @RequestParam @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getVillageContactList(townNumber,villageNumber,search));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 党支部-组织结构-照片墙
     *
     * @return
     */
    @Operation(summary = "党支部-组织结构-照片墙")
    @GetMapping("getPartyOrgPositionInformation")
    @Parameters
    @ResponseBody
    public AjaxResult getPartyOrgPositionInformation(
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getPartyOrgPositionInformation(villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 党支部-组织结构-树形结构
     *
     * @return
     */
    @Operation(summary = "党支部-组织结构-树形结构")
    @GetMapping("getPartyOrgPositionInformationTree")
    @Parameters
    @ResponseBody
    public AjaxResult getPartyOrgPositionInformationTree(
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getPartyOrgPositionInformationTree(villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 村委会-组织结构-照片墙
     *
     * @return
     */
    @Operation(summary = "村委会-组织结构-照片墙")
    @GetMapping("getVillagePositionInformation")
    @Parameters
    @ResponseBody
    public AjaxResult getVillagePositionInformation(
            @RequestParam @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getVillagePositionInformation(villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 村委会-组织结构-树形
     *
     * @return
     */
    @Operation(summary = "村委会-组织结构-树形")
    @GetMapping("getVillagePositionInformationTree")
    @Parameters
    @ResponseBody
    public AjaxResult getVillagePositionInformationTree(
            @RequestParam @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getVillagePositionInformationTree(villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 根据镇村编码取取党支部信息列表
     *
     * @return
     */
    @Operation(summary = "根据镇村编码取取党支部信息列表")
    @GetMapping("getPartyOrgListByTownVillageNumber")
    @Parameters
    @ResponseBody
    public AjaxResult getPartyOrgListByTownVillageNumber(
            @RequestParam @Parameter(description = "镇id") String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getPartyOrgListByTownVillageNumber(townNumber,villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

     /**
     * 领导班子（包村干部）-组织结构-照片墙
     *
     * @return
     */
    @Operation(summary = "领导班子（包村干部）-组织结构-照片墙")
    @GetMapping("getVillageLeaderPositionInformation")
    @Parameters
    @ResponseBody
    public AjaxResult getVillageLeaderPositionInformation(
            @RequestParam @Parameter(description = "村id") String villageNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getVillageLeaderPositionInformation(villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }
    /**
     *  便民服务供求关系
     * @param category
     * @param type
     * @param townNumber
     * @param villageNumber
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Operation(summary = " 便民服务供求关系")
    @GetMapping("/getConvenientServiceList")
    @ResponseBody

    public AjaxResult getConvenientServiceList(
            @RequestParam String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search,
            @RequestParam(required = false) @Parameter(description = "0: 农机 1：惠民服务") String category,
            @RequestParam(required = false) @Parameter(description = "类型 0:供应  1:求购") String type,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getConvenientServiceList(townNumber, villageNumber,search,category,type,pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 便民服务供求关系分类
     *
     * @return
     */
    @Operation(summary = "便民服务供求关系分类")
    @GetMapping("getConvenientServiceCategory")
    @Parameters
    @ResponseBody
    public AjaxResult getConvenientServiceCategory(
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getConvenientServiceCategory());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     * 便民服务供求关系-详情
     *
     * @return
     */
    @Operation(summary = "便民服务供求关系-详情")
    @GetMapping("getConvenientServiceDetail")
    @Parameters
    @ResponseBody
    public AjaxResult getConvenientServiceDetail(
            @RequestParam @Parameter(description = "id") String agriculturalMachinerySerialNumber
    )
    {
        try {
            return success(
                    microSmartMoHeResidentService.
                            getConvenientServiceDetail(agriculturalMachinerySerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }

    }

    /**
     *  我的-便民服务供求关系
     * @param category
     * @param type
     * @param phone
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Operation(summary = "我的-便民服务供求关系")
    @GetMapping("/getMyConvenientServiceList")
    @ResponseBody

    public AjaxResult getMyConvenientServiceList(
            @RequestParam String phone,
            @RequestParam(required = false) @Parameter(description = "搜索") String category,
            @RequestParam(required = false) @Parameter(description = "状态") String type,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getMyConvenientServiceList(phone,category,type,pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 小程序 账户信息
     * @param phone
     * @return
     */
    @Operation(summary = "小程序 账户信息")
    @Parameters({
            @Parameter(name = "phone", description = "手机号"),
    })
    @GetMapping("/getMicroAccountInformation")
    @ResponseBody
    public AjaxResult getMicroAccountInformation(
            @RequestParam String phone,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber
    ){
        try {
            return success(microSmartMoHeResidentService.getMicroAccountInformation(phone,villageNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 普法矩阵
     * @param type
     * @return
     */
    @Operation(summary = "普法矩阵")
    @Parameters({
            @Parameter(name = "type", description = "类型"),
            @Parameter(name = "search", description = "搜索"),
    })
    @GetMapping("/getLawMatrix")
    @ResponseBody
    public AjaxResult getLawMatrix(
            @RequestParam(required = false) String type,
            @RequestParam(required = false) String   search
    ){
        try {
            return success(microSmartMoHeResidentService.getLawMatrix(type,search));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }


    @Operation(summary = "蓝牌标签")
    @Parameters({
            @Parameter(description = "标签序列号-非必填", name = "tagSerialNumber", required = false)
    })
    @GetMapping("/getAllBluePlateTags")
    @ResponseBody
    public AjaxResult getAllBluePlateTags(
            @RequestParam(required = false) @Parameter(description = "标签序列号") String tagSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getAllBluePlateTags(tagSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "地图资源-根据我的定位和蓝牌标签获取点位列表")
    @Parameters({
            @Parameter(description = "标签序列号-非必填", name = "tagSerialNumber", required = false),
            @Parameter(description = "搜索-非必填", name = "search", required = false),
            @Parameter(description = "我的位置-必填", name = "myCoords", required = false),
            @Parameter(description = "几公里内 默认1km", name = "km", required = false)
    })
    @GetMapping("/getMapBluePlateByTagsAndCoords")
    @ResponseBody
    public AjaxResult getMapBluePlateByTagsAndCoords(
            @RequestParam(required = false) @Parameter(description = "标签序列号") String tagSerialNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search,
            @RequestParam(required = false,defaultValue = "1") @Parameter(description = "几公里内 默认1km") String km,
            @RequestParam @Parameter(description = "我的位置") String currentCoords
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMapBluePlateByTagsAndCoords(tagSerialNumber, search,km,currentCoords));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    @Operation(summary = "地图资源-详情")
    @Parameters({
            @Parameter(description = "蓝牌序列号-必填", name = "bluePlateSerialNumber"),
            @Parameter(description = "标签序列号-必填", name = "tagSerialNumber"),

    })
    @GetMapping("/getMapBluePlateDetail")
    @ResponseBody
    public AjaxResult getMapBluePlateDetail(
            @RequestParam @Parameter(description = "蓝牌序列号") String bluePlateSerialNumber,
            @RequestParam @Parameter(description = "标签序列号") String tagSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getMapBluePlateDetail(bluePlateSerialNumber,tagSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 农资店列表查询
     *
     */
    @Operation(summary = "农资店列表查询")
    @Parameters({
            @Parameter(description = "搜索-非必填", name = "search", required = false)
    })
    @GetMapping("/getAgricultureResourceServiceList")
    @ResponseBody
    public AjaxResult getAgricultureResourceServiceList(
            @RequestParam String townNumber,
            @RequestParam(required = false) @Parameter(description = "村id") String villageNumber,
            @RequestParam(required = false) @Parameter(description = "搜索") String search

    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getAgricultureResourceServiceList(townNumber,villageNumber,search));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    @Operation(summary = "农资店-详情")
    @Parameters({
            @Parameter(description = "店铺id", name = "shopSerialNumber"),
    })
    @GetMapping("/getAgricultureResourceServiceDetail")
    @ResponseBody
    public AjaxResult getAgricultureResourceServiceDetail(
            @RequestParam @Parameter(description = "店铺id") String shopSerialNumber
    ) {
        try {
            return AjaxResult.success(microSmartMoHeResidentService.getAgricultureResourceServiceDetail(shopSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    /**
     * 首页轮播-村民端
     *
     * @return
     */
    @Operation(summary = "首页轮播-村民端")
    @Parameters({
    })
    @GetMapping("getCarouselConfig")
    @ResponseBody
    public AjaxResult getCarouselConfig(
    ) {
        try {

            return success(microSmartMoHeResidentService
                    .getCarouselConfig()
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("商超-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 小程序 村民端-留言
     *
     * @param phone
     * @return
     */
    @Operation(summary = "小程序 村民端-留言")
    @GetMapping("/getLeaveWord")
    @ResponseBody

    public AjaxResult getLeaveWord(
            @RequestParam @Parameter(description = "用户手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "评论回复状态") String replyStatus,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getLeaveWord(phone, replyStatus, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  我的返乡登记 - 列表
     *
     * @param phone
     * @return
     */
    @Operation(summary = "我的返乡登记列表")
    @GetMapping("/getMyRoundTripRegistrationList")
    @ResponseBody
    @Parameters({
            @Parameter(description = "用户手机号", name = "phone"),
            @Parameter(description = "当前页数", name = "pageNum"),
            @Parameter(description = "每页条数", name = "pageSize"),
    })
    public AjaxResult getMyRoundTripRegistrationList(
            @RequestParam String phone,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeResidentService.getMyRoundTripRegistrationList(phone, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  返乡登记详情
     *
     * @param registrationSerialNumber
     * @return
     */
    @Operation(summary = "返乡登记详情")
    @GetMapping("/getMyRoundTripRegistrationDetail")
    @ResponseBody
    @Parameters({
            @Parameter(description = "返乡登记序列号", name = "registrationSerialNumber"),
    })
    public AjaxResult getMyRoundTripRegistrationDetail(
            @RequestParam String registrationSerialNumber

    ) {
        try {
            return success(microSmartMoHeResidentService.getMyRoundTripRegistrationDetail(registrationSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  根据我的身份证获取我签合同的确权地块列表
     *
     * @param iDCardNumber
     * @return
     */
    @Operation(summary = "根据我的身份证获取我签合同的确权地块列表")
    @GetMapping("/getMyContractNatureResourceList")
    @ResponseBody
    @Parameters({
            @Parameter(description = "身份证号", name = "iDCardNumber"),
    })
    public AjaxResult getMyContractNatureResourceList(
            @RequestParam String iDCardNumber

    ) {
        try {
            return success(microSmartMoHeResidentService.getMyContractNatureResourceList(iDCardNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    /**
     *  根据我的身份证获取我的专职网格员列表
     *
     * @param iDCardNumber
     * @return
     */
    @Operation(summary = " 根据我的身份证获取我的专职网格员列表")
    @GetMapping("/getMyGridMemberListByIdCardNumber")
    @ResponseBody
    @Parameters({
            @Parameter(description = "身份证号", name = "iDCardNumber"),
    })
    public AjaxResult getMyGridMemberListByIdCardNumber(
            @RequestParam String iDCardNumber

    ) {
        try {
            return success(microSmartMoHeResidentService.getMyGridMemberListByIdCardNumber(iDCardNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     *  根据年月获取签到信息
     *
     * @param yearMonth
     * @return
     */
    @Operation(summary = " 根据年月获取签到信息")
    @GetMapping({"/getSignInformation"})
    @ResponseBody
    @Parameters({
            @Parameter(description = "年月", name = "yearMonth"),
            @Parameter(description = "手机号", name = "phone"),
    })
    public AjaxResult getSignInformation(@RequestParam("yearMonth") String yearMonth,@RequestParam("phone")String phone) {
        try {
            return success(microSmartMoHeResidentService.getSignInformation(yearMonth,phone));
        }catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
}
